import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/components/Layout.vue';
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Login',
      meta: {
        require_auth: false,
        route_name: '登录',
      },
      component: () => import('@/views/Account/Login.vue')
    },
    {
      path: '/home',
      name: 'Home',
      component: Layout,
      children:[
        {
          path: 'list',
          name: 'HomeList',
          meta: {
            require_auth: false,
            route_name: '主页',
            icon:'HomeFilled',
          },
          component: () => import('@/views/Home/List.vue')
        }
      ]
    },
    {
      path: '/user',
      name: 'User',
      meta: {
        require_auth: false,
        route_p_name: '用户',
        icon:'User',
      },
      component: Layout,
      children:[
        {
          path: 'list',
          name: 'UserList',
          meta: {
            require_auth: false,
            route_name: '用户管理',
          },
          component: () => import('@/views/User/List.vue')
        },
        {
          path: 'group',
          name: 'UserGroup',
          meta: {
            require_auth: false,
            route_name: '用户分组',
          },
          component: () => import('@/views/User/Group.vue')
        },
        {
          path: 'level',
          name: 'UserLevel',
          meta: {
            require_auth: false,
            route_name: '用户等级',
          },
          component: () => import('@/views/User/Level.vue')
        },
        {
          path: 'label',
          name: 'UserLabel',
          meta: {
            require_auth: false,
            route_name: '用户标签',
          },
          component: () => import('@/views/User/Label.vue')
        },
      ]
    },
    {
      path: '/product',
      name: 'Product',
      meta: {
        require_auth: false,
        route_p_name: '商品',
        icon:'ShoppingBag',
      },
      component: Layout,
      children:[
        {
          path: 'list',
          name: 'ProductList',
          meta: {
            require_auth: false,
            route_name: '商品管理',
          },
          component: () => import('@/views/Product/List.vue')
        },
        {
          path: 'classify',
          name: 'ProductClassify',
          meta: {
            require_auth: false,
            route_name: '商品分类',
          },
          component: () => import('@/views/Product/Classify.vue')
        },
        {
          path: 'attr',
          name: 'ProductAttr',
          meta: {
            require_auth: false,
            route_name: '商品规格',
          },
          component: () => import('@/views/Product/Attr.vue')
        },
        {
          path: 'reply',
          name: 'ProductReply',
          meta: {
            require_auth: false,
            route_name: '商品评论',
          },
          component: () => import('@/views/Product/Reply.vue')
        },
        {
          path: 'listreply',
          name: 'ProductListReply',
          meta: {
            require_auth: false,
            route_name: '商品评论',
          },
          component: () => import('@/views/Product/ListReply.vue')
        },
        {
          path: 'updata/:product_id',
          name: 'ProductUpdata',
          meta: {
            require_auth: false,
            route_name: '商品更新',
          },
          component: () => import('@/views/Product/Updata.vue')
        },
      ]
    },
    {
      path: '/order',
      name: 'Order',
      meta: {
        require_auth: false,
        route_p_name: '订单',
        icon:'ShoppingCart',
      },
      component: Layout,
      children:[
        {
          path: 'list',
          name: 'OrderList',
          meta: {
            require_auth: false,
            route_name: '订单管理',
          },
          component: () => import('@/views/Order/List.vue')
        },
        {
          path: 'offline',
          name: 'OrderOffline',
          meta: {
            require_auth: false,
            route_name: '收银订单',
          },
          component: () => import('@/views/Order/Offline.vue')
        },
        {
          path: 'refund',
          name: 'OrderRefund',
          meta: {
            require_auth: false,
            route_name: '售后订单',
          },
          component: () => import('@/views/Order/Refund.vue')
        },
        {
          path: 'setting',
          name: 'OrderSetting',
          meta: {
            require_auth: false,
            route_name: '核销订单',
          },
          component: () => import('@/views/Order/Setting.vue')
        },
      ]
    },
  ]
})

export default router
